# l = []
# for x in range(1,11):
#     l.append(x*x)
# print(l)
#用列表生成器
# print([x*x for x in range(1,11) ])
# print([x+y for x in 'abc' for y in 'jio'])
#for循环变量可以同时使用两个甚至是多个变量
# from typing import ItemsView


# d = ['HuangLiang','ShiJian','kongJian','Guangming']
# print([s.lower() for s in d])#把字符串变成小写

#if...else...

# print([x if x%2==0 else -x for x in range(1,11)])
# 1、不能在最后的if上加上else（例：[x for x in range(1, 11) if x % 2 == 0 else 0]）
# 2、if写在for前面必须加else

# 练习
l1 = ['Hello', 'World', 18, 'Apple', None]
l2 = [s.lower() for s in l1 if isinstance(s, str) == True]
print(l2)
if l2 == ['hello', 'world', 'apple']:
    print('测试通过')
else:
    print('测试失败')
print()